<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
    public function __construct()
    {
        parent::__construct();
        // Your own constructor code
        $this->is_logged_in();
        $this->load->helper('asset');
    } 
	private function is_logged_in()
	{
		$is_logged_in = $this->session->userdata('logged_in');
		if(!isset($is_logged_in) || $is_logged_in != true)
		{
            redirect('user/login');		
			//$this->load->view('login_form');
		}		
	}
	public function index()
	{

        add_css("assets/plugins/form-toggle/toggles.css");
        add_css("assets/plugins/codeprettifier/prettify.css");
        add_css("assets/plugins/form-markdown/css/bootstrap-markdown.min.css");
        add_css("assets/plugins/fullcalendar/fullcalendar.css");       
        add_css("assets/plugins/form-daterangepicker/daterangepicker-bs3.css");
        
        $data['js_files'] = get_js();
        add_js("assets/plugins/fullcalendar/fullcalendar.min.js");
        add_js("assets/plugins/form-daterangepicker/daterangepicker.min.js");
        add_js("assets/plugins/form-daterangepicker/moment.min.js");
        add_js("assets/plugins/charts-flot/jquery.flot.min.js");
        add_js("assets/plugins/charts-flot/jquery.flot.resize.min.js");
        add_js("assets/plugins/charts-flot/jquery.flot.orderBars.min.js");
        add_js("assets/plugins/pulsate/jQuery.pulsate.min.js");
        add_js("assets/demo/demo-index.js");

        $data['css_files'] = get_css();
        $data['js_files'] = get_js();
	    $data['subview'] = 'dashboard';
        
		$this->load->view('layouts/default',$data);
	}
    public function user_list()
    {
        $data['panel_users'] = $this->db->get('mdm_panel_users')->result();


        add_css("assets/plugins/datatables/dataTables.css");
        add_css("assets/plugins/codeprettifier/prettify.css");
        add_css("assets/plugins/form-toggle/toggles.css");
        
        $data['js_files'] = get_js();
        add_js("assets/plugins/datatables/jquery.dataTables.min.js");
        add_js("assets/plugins/datatables/dataTables.bootstrap.js");
        add_js("assets/demo/demo-datatables.js");
        
        $data['css_files'] = get_css();
        $data['js_files'] = get_js();
        $data['subview'] = 'page_user_list';
        $this->load->view('layouts/default',$data);
    }
    public function test()
    {
        
        $this->load->helper('asset');
        echo "<pre>";
        
        echo(get_css()[0]);
        echo "</pre>";
        die();
   
            
   
    
        $data['subview'] = 'test';
        $this->load->view('layouts/default',$data);        
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */